import { GET_HOME_SWIPER, GET_HOME_NAV, GET_HOME_GOODS } from "../action/actionType";

const listState = {
  arr: [],
  list: [],
  shop: [],
};
// 定义初始的state
// 写一些action的逻辑
export default function (state = listState, action) {
  let newState = JSON.parse(JSON.stringify(state));
  switch (action.type) {
    case GET_HOME_SWIPER:
      newState.arr = action.payload;
      return newState;
    case GET_HOME_NAV:
      newState.list = action.payload;
      return newState;
    case GET_HOME_GOODS:
      newState.shop = action.payload;
      return newState;
    default:
      return state;
  }
}
